{include file="public/header" /}
<title>{:lang('留言反馈')}</title>
<header id="header" class="mui-bar mui-bar-nav">
    <div class="mui-pull-left PopupNavigation">
        <img src="/static/home/bl_1.png" alt="">
    </div>
    <h1 class="mui-title">{:lang('留言反馈')}</h1>
    <div class="mui-pull-right" style="display: none;">
        <div class="mui-switch mui-active">
            <div class="mui-switch-handle"></div>
        </div>
    </div>
</header>    
{include file="public/menu" /}
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
    <div class="mui-scroll">
        <form class="messageFrom">
            <div class="messagepadBox">
                <div class="messagepadCnt">
                    <textarea name="content" cols="30" rows="10" placeholder="{:lang('请输入你要提交的问题')}" class="textareawbk"></textarea>
                    <div class="messageleixin df">
                        <div>{:lang('类型')}：</div>
                        <div class="fx1">
                            <select name="type">
                                <option value="0">--{:lang('请选择回答消息类型')}--</option>
                                <option value="1">{:lang('财务')}</option>
                                <option value="2">{:lang('报单')}</option>
                                <option value="3">{:lang('代理')}</option>
                                <option value="4">{:lang('服务中心')}</option>
                                <option value="5">{:lang('提现')}</option>                            
                            </select>
                        </div>
                        <div><i class="mui-icon mui-icon-arrowright i"></i></div>
                    </div>
                    <div class="applicaageAnbox">
                        <button class="applicaageAn subForm">{:lang('提交')}</button>
                    </div>
                </div>
                <div class="ckanmessageBox">
                    <div class="ckanmessage likeA" data-url="{:url('message/messagelist')}">{:lang('查看我的留言')}</div>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="public/footer" /}

<script>
    mui('.mui-scroll-wrapper').scroll({
        deceleration: 0.0005
    });
    var isSub = true;
    mui('body').on('tap', '.subForm', function() {
        var obj = $(this);
        if(isSub) {
            isSub = false;
            var data = $('.messageFrom').serialize();
            console.log(data);
            var url = "{:url('message/sendMessage')}";
            mui.showLoading("提交中","div");
            mask.show();//显示遮罩层
            $.ajax({
                type: 'post',
                url: url,
                data: data,
                dataType: 'json',
                success: function (res) {
                    mask.close();//关闭遮罩层
                    mui.hideLoading();
                    if (res.status == 1) {
                        mui.toast(res.msg, {duration: '2000', type: 'div'});
                        setTimeout(function () {
                            mui.openWindow({
                                id: res.url,
                                url: res.url
                            });
                        }, 2000);
                    } else {
                        isSub = true;
                        return mui.toast(res.msg, {duration: '2000', type: 'div'});
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    return mui.toast('网络失败，请刷新页面后重试', {duration: '2000', type: 'div'});
                }
            });
        }
    });
</script>
</body>

</html>